package com.user.controller;

import com.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.buchong.pojo.User;

import java.util.Date;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/sel")
    public User show(String name) {
        return userService.selByName(name);
    }
    @RequestMapping("/ins")
    public int show1(String name,String password) {
        User user=new User();
        user.setPwd(password);
        user.setUserName(name);
        user.setRole(1);
        user.setCreate_date(new Date());
        return userService.putOne(user);
    }
}
